<extend name="Common@Layout:hui-admin" />
<block name="title"><title>Administator管理后台</title></block>
<block name="style">
<style>
.listorder {width:60px;text-align:center;}
</style>
</block>

<block name="main">
	<nav class="breadcrumb">
		<i class="Hui-iconfont"></i>
		 首页 <span class="c-gray en">&gt;</span>
		 内容管理 <span class="c-gray en">&gt;</span>  
		 校区列表 
		<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
	</nav>
	
	<div class="pd-20">
		<div class="text-c"> 
			<form status="{:u('index')}" method="get" id="form">
			 日期范围：
			<input type="text" name="start_time" value="{$_GET['start_time']}" class="input-text mini-time" style="width:120px;">
			-
			<input type="text" name="end_time" value="{$_GET['end_time']}" class="input-text mini-time" style="width:120px;">
			<input type="hidden" name="searchtype" value="title">
			<input type="text" name="keywords" value="{$_GET['keywords']}" id="" placeholder="标题关键词" style="width:250px" class="input-text">
			<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont"></i> 搜索</button>
			</form>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20"> 
			<span class="l ml-20"> 
				<a href="javascript:;" class="btn btn-danger radius ajax-post confirm" target-form="mini-form" data-msg="确定批量删除？" data-url="{:U('Districtadmin/del')}"><i class="Hui-iconfont"></i> 批量删除</a> 
				<a class="btn btn-primary radius" href="javascript:;" onclick="open_iframe_dialog('{:U('Districtadmin/edit')}','添加校区',['90%','90%'],1)"><i class="Hui-iconfont"></i> 添加校区</a> 
			</span> 
		</div>
		<php>
			$xiaoqu = R('Apiadmin/getxiaoqurole');
			if($xiaoqu){
				$map['id'] = array('in',$xiaoqu);
			}
			$result = _get_list_data('/Ygcl/Districtadmin/index/',$_GET,$map,D('YgclDistrict'),'','listorder desc,id desc');
		</php>
		<form class="mini-form">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="25"><input type="checkbox" name="" value=""></th>
					<th width="80">ID</th>
					<th>校区</th>
					<th width="120"></th>
					<th width="60">点赞</th>
					<th width="60">排序</th>
					<!-- <th width="120">更新时间</th> -->
					<th width="60">发布状态</th>
					<th width="120">操作</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="result['data']['list']" item="vo">
				<tr class="text-c">
					<td><input type="checkbox" value="{$vo['id']}" name="ids[]"></td>
					<td>{$vo['id']}</td>
					<td class="text-l">
						{:replace_query_str($_GET['keywords'],$vo['title'])}
					</td>
					<td>
						<a class="btn btn-primary radius" onclick="parent.Hui_admin_tab(this)" _href="{:U('classadmin/index',array(did=>$vo['id']))}" data-title="{$vo['title']}的课程管理">课程管理</a>
						<!-- <a class="btn btn-primary radius"  onclick="open_iframe_dialog('{:U('teacheradmin/index',array(did=>$vo['id']))}','{$vo['title']} 教师管理',['90%','90%'],1)" >教师</a> -->
					</td>
					<td>{$vo.dianzai}</td>
					<td><input type="text" class="listorder input-text" value="{$vo.listorder}" data-id="{$vo.id}"/></td>
					<!-- <td>{$vo.create_time}</td> -->
					<td class="td-status">
						<if condition="$vo['status'] eq 1">
						<span class="label label-success radius">显示</span>
						</if>
						<if condition="$vo['status'] eq 2">
						<span class="label label-default radius">隐藏</span>
						</if>
					</td>
					<td class="f-14 td-manage">
						<if condition="$vo['status'] eq 1">
						<a style="text-decoration:none" class="ml-5 ajax-get shuaxin" data-url="{:U('Districtadmin/changestatus','id='.$vo['id'].'&status=2')}" href="javascript:;" title="下架"><i class="Hui-iconfont"></i></a>
						</if>
						<if condition="$vo['status'] eq 2">
						<a style="text-decoration:none" class="ml-5 ajax-get shuaxin" data-url="{:U('Districtadmin/changestatus','id='.$vo['id'].'&status=1')}" href="javascript:;" title="发布"><i class="Hui-iconfont"></i></a>
						</if>
						<a style="text-decoration:none" class="ml-5" onclick="open_iframe_dialog('{:U('Districtadmin/edit',array('id'=>$vo['id']))}','编辑校区',['90%','90%'],1)" href="javascript:;" title="编辑"><i class="Hui-iconfont"></i></a>
            			<a style="text-decoration:none" class="ml-5 mini_del" data-url="{:U('Districtadmin/del','ids='.$vo['id'])}" href="javascript:;" title="删除"><i class="Hui-iconfont"></i></a>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		</form>
		{$result['pagetpl']}
	</div>
	
	
</block>

<block name="script">
<script>
$(function(){
	$('.mini-time').datepicker();
});
$(".listorder").blur(function(){
	var id = $(this).attr("data-id");
	var listorder = $(this).val();
	var data = {
		id:id,
		listorder:listorder,
		type:'district'
	};
	$.post("/Ygcl/Apiadmin/changelistorder",data,function(data){
		if(data.status){
			location.reload();
		}
	})
})
</script>
</block>